package cn.zlg.common.datadump.processor;

import cn.zlg.common.datadump.annotation.DataDumpEntity;

/**
 * 提供在保存数据、覆盖数据、保存完成后的回调
 * @param <F>
 * @param <T>
 */
public interface ImportEntityProcessor<F,T> {

    /**
     * 验证前处理
     * @param origin
     * @param annotation
     * @return
     */
    F processBeforeValidate(F origin, DataDumpEntity annotation);

    /**
     * 验证后调用
     * @param origin
     * @param annotation
     * @return
     */
    F processAftertValidate(F origin, DataDumpEntity annotation);

    /**
     * 保存前处理
     * @param origin
     * @param entity
     * @param annotation
     * @return
     */
    T processBeforeSave(F origin, T entity, DataDumpEntity annotation);

    /**
     * 覆盖现有记录前调用处理
     * @param origin
     * @param entity
     * @param annotation
     * @param override 覆盖已有记录
     * @return
     */
    T processBeforePersist(F origin, T entity, DataDumpEntity annotation, boolean override);

    /**
     * 保存后处理
     * @param origin
     * @param entity
     * @param annotation
     * @return
     */
    T processAfterSave(F origin, T entity, DataDumpEntity annotation);


}
